<template>
<el-card>
  <div slot="header" class="clearfix">
    <span>个人信息</span>
  </div>
  <!-- <el-card shadow="hover" class="subcard"> -->
      <div class="subcard"><i class="el-icon-service i"></i>UID: {{ admin.workerId }}</div>
      <!-- </el-card> -->
  <!-- <el-card shadow="hover" class="subcard"> -->
      <div class="subcard"><i class="el-icon-view i" ></i>姓名: {{ admin.name ? admin.name : '无' }}</div>
      <!-- </el-card> -->
  <!-- <el-card shadow="hover" class="subcard"> -->
      <!-- <div class="subcard"><i class="el-icon-service i" ></i>职务: {{ admin.department ? admin.department : '无' }}</div> -->
      <!-- </el-card> -->
  <!-- <el-card shadow="hover" class="subcard"> -->
      <div class="subcard"><i class="el-icon-phone-outline i" ></i>电话: {{ admin.phone ? admin.phone : '无'}}</div>
      <!-- </el-card> -->
  <!-- <el-card shadow="hover" class="subcard"> -->
      <div class="subcard"><i class="el-icon-message i" ></i>邮箱: {{ admin.email ? admin.email : '无' }}</div>
      <!-- </el-card> -->
  <!-- <el-card shadow="hover" class="subcard"> -->
      <div class="subcard"><i class="el-icon-tickets i" ></i>权限: <el-tag>{{ admin.role }}</el-tag></div>
      <!-- </el-card>  -->
  <!-- <el-card shadow="hover" class="subcard"> -->
      <div class="subcard"><i class="el-icon-location-outline i" ></i>住址: {{ admin.address ? admin.address : '无'}}</div>
      <!-- </el-card> -->
</el-card>
</template>
<script>
import { getByUserName } from "../../api/admin";
import { getInfo } from "../../api/login";
import Cookies from "js-cookie";
import axios from 'axios'
// import VueAxios from 'vue-axios'


export default {
  data: function () {
    return {
      admin: {
        //   address: null
        // createTime: "2022-06-29T08:32:22.000+0000"
        // department: null
        // email: null
        // gender: "男"
        // name: "admin"
        // password: "E10ADC3949BA59ABBE56E057F20F883E"
        // phone: "13556648745"
        // role: "admin"
        // updateTime: "2022-06-29T10:14:55.000+0000"
        // username: "admin"
        // workerId: 101
      },
    };
  },
  created: function () {
    const that = this;
    // console.log(Cookies.get("role"))
    console.log(Cookies.get("admin_name"))
    var role=Cookies.get("role")
    if(role=='admin'){
      getByUserName(Cookies.get("admin_name"))
      .then((res) => {
        that.admin = res.data;
      })
      .catch((res) => {
        this.$message.error("信息获取失败");
      });
    }else{
      getByUserName(Cookies.get("admin_name"))
      .then((res) => {
        that.admin = res.data;
      })
      .catch((res) => {
        this.$message.error("信息获取失败");
      });
    }
  },
};
</script>
<style lang="scss" scoped>
.text {
  font-size: 14px;
}

.item {
  padding: 18px 0;
}
.i{
    margin: 0 15px;
    color: rgb(87, 136, 228);
}
.subcard{
    // margin: 10px auto 20px;
    height: 65px;
    line-height: 65px;
    border: 1px solid rgb(236, 236, 236);
    border-left: 0;
    border-right: 0;
    border-top:0;
}
</style>